<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<style>
        .row .btn{ width:90px;height:90px;border-radius:50%;margin: 20px}
/*         /*.row1{ position:relative;margin-left:30px;}*/
        /*.row2{ float: right;margin-top:40px;margin-right:-60px;position:relative;}*/
        /*.row2 .item{ float:right;position:relative;width: 165px;height: 100px;}*/
        /*.item .icon{ transform: rotate(180deg);position: absolute;right: -15px;top: -10px;}*/
        /*.row2 .btn{position: relative;}*/ */
        .icon{ transform: rotate(180deg);position: absolute;right: -15px;top: -10px;}
        .task span{
            display: block;
            font-size: 22px;
            font-weight: bold;
            margin-top: -15px;
        }
        .txt{ font-size:14px;margin-top:50px;text-indent: 2em;}
        </style>
</head>
<body class="gray-bg" >
	<nav class="huiNav">
		<i class="fa fa-home"></i> 首页 <span>&gt;个人中心<span>&gt;新手任务</span>
		<a class="btn btn-info  btn-sm pull-right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="fa fa-refresh"></i></a>
	</nav>
	<h3 class="text-center">新手培训</h3>
	<div class="ibox-content container task">
			<div class="row" id="row1" hidden>
				<div class="list col-sm-9 col-sm-push-3">
		            <button class="btn btn-success "  onclick="chooseJava()"  >Java</button>
		            <button class="btn btn-success "  onclick="chooseiOS()"  >iOS</button>
		            <button class="btn btn-success "  onclick="chooseAndroid()"  >Android</button>
		        </div>
		     </div>
		    <div class="row" id="row2" hidden>
		        <div class="list col-sm-9 col-sm-push-2">
		            <button class="btn btn-success " id="javabtn1" onclick="bindTutor()" > <span>1</span>绑定导师</button>
		            <button class="btn btn-success " id="javabtn2" onclick="newRead()"  disabled> <span>2</span>新手必读</button>
		            <button class="btn btn-success " id="javabtn3" onclick="developmentSpecification()"  disabled>  <span>3</span>开发规范</button>
		            <button class="btn btn-success " id="javabtn4" onclick="frameTeaching()"  disabled>  <span>4</span>框架教学</button>
		        </div>
		        <div class="list col-sm-9 col-sm-push-3">
		            <button class="btn btn-success" id="javabtn5" onclick="videoStudent()"  disabled>  <span>5</span>视频学习</button>
		            <button class="btn btn-success" id="javabtn6" onclick="weeklyReport()"  disabled>  <span>6</span>撰写周报</button>
		            <button class="btn btn-success" id="javabtn7" onclick="environmentBuilding()"  disabled>  <span>7</span>环境搭建</button>
		            <button class="btn btn-success" id="javabtn8" onclick="frameDisabuse()"  disabled>  <span>8</span>框架解惑</button>
		        </div>
		        <div class="list col-sm-9 col-sm-push-2">
		            <button class="btn btn-success" id="javabtn9" onclick="workPractice()"  disabled>  <span>9</span>作品练习</button>
		            <button class="btn btn-success" id="javabtn10" onclick="tutorScore()"  disabled>  <span>10</span>导师评分</button>
		            <button class="btn btn-success" id="javabtn11" onclick="selectTutorScore()"  >  <span>11</span>查看评分</button>
		        </div>
	    	</div>
	    	<div class="row" id="row4" hidden>
		        <div class="list col-sm-9 col-sm-push-3">
		            <button class="btn btn-success " id="androidbtn1" onclick="bindTutor()" > <span>1</span>绑定导师</button>
		            <button class="btn btn-success " id="androidbtn2" onclick="newRead()"  disabled> <span>2</span>新手必读</button>
		            <button class="btn btn-success " id="androidbtn3" onclick="developmentSpecification()"  disabled>  <span>3</span>开发规范</button>
		        </div>
		        <div class="list col-sm-9 col-sm-push-4">
		            <button class="btn btn-success" id="androidbtn4" onclick="weeklyReport()"  disabled>  <span>4</span>撰写周报</button>
		            <button class="btn btn-success" id="androidbtn5" onclick="environmentBuilding()"  disabled>  <span>5</span>环境搭建</button>
		        </div>
		        <div class="list col-sm-9 col-sm-push-3">
		            <button class="btn btn-success" id="androidbtn6" onclick="workPractice()"  disabled>  <span>6</span>作品练习</button>
		            <button class="btn btn-success" id="androidbtn7" onclick="tutorScore()"  disabled>  <span>7</span>导师评分</button>
		            <button class="btn btn-success" id="androidbtn8" onclick="selectTutorScore()" >  <span>8</span>查看评分</button>
		        </div>
	    	</div>
		<p class="txt">
			新人培训时间5-10个工作日，新入职的同事完成新人培训流程后，考核评分满60分则满足留任的基本条件(java评分标准)。新人培训期间导师会指导新手的各种问题，有疑问请随时和导师沟通。
		</p>
	</div>  
</body>
<script type="text/javascript">
/**
 * 查询新手已经进行到哪个新手任务
 */
$(function() {
	 $.AjaxProxy().invoke(
			"${path}/admin/taskExecution/showUserTask",
			function(loj) {
				console.log(loj.getValue("mapInfo").newAssessment.developmentType);
				if(loj.getValue("mapInfo").newAssessment.developmentType == null){
					$("#row1").show();
				}
				//Java开发
				if(loj.getValue("mapInfo").newAssessment.developmentType == 'Java'){
					$("#row2").show();
					if(loj.getValue("info")=='新手任务开始'){
						$("#javabtn1").attr('disabled',false);
					}
					if(loj.getValue("info")=='新手任务完成中'){
						console.log(loj.getValue("total"));
						$("#javabtn"+(loj.getValue("total")+1)).attr('disabled',false);
					}
				}
				
				//iOS开发
				if(loj.getValue("mapInfo").newAssessment.developmentType == 'iOS'){
					$("#row3").show();
					if(loj.getValue("info")=='新手任务开始'){
						$("#iOSbtn1").attr('disabled',false);
					}
					if(loj.getValue("info")=='新手任务完成中'){
						console.log(loj.getValue("total"));
						$("#iOSbtn"+(loj.getValue("total")+1)).attr('disabled',false);
					}
				}
				
				//Android开发
				if(loj.getValue("mapInfo").newAssessment.developmentType == 'Android'){
					$("#row4").show();
					if(loj.getValue("info")=='新手任务开始'){
						$("#androidbtn1").attr('disabled',false);
					}
					if(loj.getValue("info")=='新手任务完成中'){
						console.log(loj.getValue("total"));
						$("#androidbtn"+(loj.getValue("total")+1)).attr('disabled',false);
					}
				}
		}); 
})
	/**
	*选择Java开发
	**/
	function chooseJava(){
		var developmentType = "Java";
		layer.confirm("确认选择Java开发？",function(){
	        $.AjaxProxy().invoke("${path}/admin/newAssessment/chooseLanguage?developmentType="+developmentType,function(loj){
	        	if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
						location.reload();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
	        });
		});
	}
	/**
	*选择iOS开发
	**/
	function chooseiOS(){
		var developmentType = "iOS";
		layer.confirm("确认选择iOS开发？",function(){
	        $.AjaxProxy().invoke("${path}/admin/newAssessment/chooseLanguage?developmentType="+developmentType,function(loj){
	        	if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
						location.reload();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
	        });
		});
	}
	/**
	*选择Android开发
	**/
	function chooseAndroid(){
		var developmentType = "Android";
		layer.confirm("确认选择Android开发？",function(){
	        $.AjaxProxy().invoke("${path}/admin/newAssessment/chooseLanguage?developmentType="+developmentType,function(loj){
	        	if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
						location.reload();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
	        });
		});
	}
	/**
	*绑定导师
	*/
	function bindTutor(){
		layer.full(layer.open({
			type : 2,
			title : "绑定导师",
			area : [ MUI.SIZE_L, '400px' ],
			maxmin : true,
			content : [ '${path}/admin/redirect/binding-tutor-list']
		}));
	}
	/**
	*新手必读
	*/
function newRead(){
	layer.full(layer.open({
		type : 2,
		title : "新手必读",
		area : [ MUI.SIZE_L, '400px' ],
		maxmin : true,
		content : [ '${path}/admin/redirect/new-read-list']
	}));
}
	/**
	*开发规范
	*/
	function developmentSpecification(){
		layer.full(layer.open({
			type : 2,
			title : "开发规范",
			area : [ MUI.SIZE_L, '400px' ],
			maxmin : true,
			content : [ '${path}/admin/redirect/development-specification-list']
		}));
	}
	/**
	*新人开始框架教学任务 
	*/
	function frameTeaching(){
		layer.confirm("确认开始任务？",function(){
	        $.AjaxProxy().invoke("${path}/admin/taskExecution/startTask",function(loj){
	        	if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
	        });
		});
	}
	
	/**
	*视频学习
	*/
	function videoStudent(){
		layer.full(layer.open({
			type : 2,
			title : "视频学习",
			area : [ MUI.SIZE_L, '400px' ],
			maxmin : true,
			content : [ '${path}/admin/redirect/video-student-list']
		}));
	}
	
	/**
	*新人开始撰写周报  
	*/
	function weeklyReport(){
		layer.confirm("确认开始任务？",function(){
	        $.AjaxProxy().invoke("${path}/admin/taskExecution/startWeeklyTask",function(loj){
	        	if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
						location.reload();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
	        });
		});
	}
	
	/**
	*环境搭建
	*/
	function environmentBuilding(){
		layer.full(layer.open({
			type : 2,
			title : "环境搭建",
			area : [ MUI.SIZE_L, '400px' ],
			maxmin : true,
			content : [ '${path}/admin/taskExecution/toEnvironmentBuilding']
		}));
	}
	
	/**
	*新人开始框架解惑
	*/
	function frameDisabuse(){
		layer.confirm("确认开始任务？",function(){
	        $.AjaxProxy().invoke("${path}/admin/taskExecution/startFrameDisabuse",function(loj){
	        	if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
						location.reload();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
	        });
		});
	}
	/**
	*作品练习 
	*/
	function workPractice(){
		layer.full(layer.open({
			type : 2,
			title : "作品练习",
			area : [ MUI.SIZE_L, '400px' ],
			maxmin : true,
			content : [ '${path}/admin/taskExecution/toWorkPractice']
		}));
	}
	
	/**
	*新人开始导师评分 
	*/
	function tutorScore(){
		layer.confirm("确认开始任务？",function(){
	        $.AjaxProxy().invoke("${path}/admin/taskExecution/startTutorScore",function(loj){
	        	if(loj.getValue("status") == 'ok'){
					layer.alert(loj.getValue("info"), {
						icon : 1
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
						layer.close();
						location.reload();
					});
				}else{
					layer.alert(loj.getValue("info"), {
						icon : 5
					}, function(inindex) {
						// 关闭提示层
						layer.close(inindex);
					});
				}
	        });
		});
	}
	
	/**
	*查看导师评分  
	*/
	function selectTutorScore(id) {
		layer.full(layer.open({
			type : 2,
			title : "修改导师评价",
			area : [ MUI.SIZE_L, '400px' ],
			maxmin : true,
			content : [ '${path}/admin/taskExecution/selectTutorScore']
		}));
	}
</script>

</html>